package com.briup.app04.web.controller;

import com.briup.app04.bean.Test;
import com.briup.app04.service.ITestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {
     @Autowired
     private ITestService testService;

     @GetMapping("findAll")
     public List<Test> findAll(){

          return testService.findAll();
     }
     @PostMapping("save")
     public String save(Test cms_category){
          testService.save(cms_category);
          return"保存成功";
     }
     @PostMapping("update")
     public String update(Test cms_category){
          testService.update(cms_category);
          return "更新成功";
     }
     @PostMapping("delete")
     public String delete(Long id){
          testService.delete(id);
          return "删除成功";
     }
}
